home *** CD-ROM | disk | FTP | other *** search
-
- ----------
-
- Listing 4 - class definition for lns using a single pointer
-
- //
- // lns1a.h - line number sequence interface
- //
- #ifndef LNS_H_INCLUDED
- #define LNS_H_INCLUDED
-
- class lns
- {
- public:
- lns(unsigned n);
- ~lns();
- void add(unsigned n);
- void print();
- private:
- class node;
- node *first;
- };
-
- class lns::node
- {
- public:
- node(unsigned n);
- unsigned number;
- node *next;
- };
-
- inline lns::node::node(unsigned n)
- : number(n), next(0)
- {
- }
-
- inline lns::lns(unsigned n)
- {
- first = new node(n);
- }
-
- #endif
-
-